// import { getList } from '@/api/system/tCode'
export const dictTokenKey = 'dict_all_key'
export const dictTokenTime = 'dict_all_time'

export function getDict(key) {
  let obj = {}
  if (key) {
    const dictStr = uni.getStorageSync(dictTokenKey)
    if (dictStr) {
      obj = JSON.parse(dictStr)[key]
    }
    // else { // 从服务器查询
    //   getDictList({ label: key }).then(result => {
    //     obj = result.data
    //   })
    // }
  } else {
    obj = JSON.parse(uni.getStorageSync(dictTokenKey))
  }
  return obj
}

export function setDict(token) {
  return uni.setStorageSync(dictTokenKey, token)
}

